package com.enba.ali.pay.controller;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.CertAlipayRequest;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradePrecreateModel;
import com.alipay.api.request.AlipayTradePrecreateRequest;
import com.alipay.api.response.AlipayTradePrecreateResponse;

/** alipay-sdk-java使用 */
public class SdkV2Controller {

  public static void main(String[] args) throws AlipayApiException {
    String privateKey =
        "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCJNJsLy/L+SrrEXnI5Gx3Kw5LcWR4ZzyGfz2r94euqYCf8yIzXGU26Ey/Fzpf6fx70aW6aQMg+BgLaehyX8wG+m44s7qidNN/Uhh9ertsWHA89ZOBpVqV4F7G5tQVAesaQowIMANNfsvRbf+w02+FdvB2Fp3on+PQH1EPcqKo+SkaPsNpiNTKaOVfCd7m9YONEjwg70/Ni/2QZBDfV34hM5v7T1YxNz+VRfDsdLzQ3Q8Pr+v5XhQcl5FWrnwlf99eSIXeccio3hYyNUyTd1XibfVl22WH/+zfx2g7JHVhHRoLS7d0ZzoznVlJSiIkDa3mmruVPz0iswxsR42En7eJ5AgMBAAECggEBAIe7S9q6szNPOD5E9Jh7s9g/64wieT2tBCV1avGnypxsrYJL39B2zsbSbkMwIncDxNqjZnAgwDdjePUrMhg7pTEr79WRb6q9gORcnrHrJv9TWNwybDKpLd6FCiOd6YklLEQvjjnTo0eb4FKYVVLhZqx1CXuL97ONe9Q2779d97TQCfhTUpciaJ7+CVvXybo2Z3fi6AmYoh+frUSTFzQkfCgVED0mLpOy7Tvj+DEPIs4OPZ8sHtrZ2t1ElRtQjPueZSf3uESy4qGqTygchFvODk5U4R+1wN2VCVustP6+m70BuRD39K/8o736V9GmBO0j8Nk+vw5Chh74/5M6NEveyJECgYEA44rUO0Z5DgVONvXj5ywTrDW1XNjlXTwyIhraX2GGckPep/aY3sA5TlHjgFWQ9NJhSGxESHSV8R5K6z7foPkNaRCp+Gsh2LnDGtWACCu1FFW/AaFFVWU8dxUO1T9VRJqWwIrgz03ub+ztF4dcZUG+5I363weo8u8d9zksckxyXxUCgYEAml17sQNycnNaS7mTfxoYvENaeSuHxxv8wovuzIddnzEcLQQa/lOEnrf63CxKYDXPKcTc252R5Wfzj5juFES1HVEm8cB8VAQkiEFK8EfWGCJFwDilOC4SbLDwu989Ja2CjxXE9CV+5EURKCP1HRMqf+NGts3kBUEgE+WwyXSzLtUCgYEAifVnXhUJWnXfCTWmm0e/Gb9qmcOrtQ7FOqZbVk80C92Yhu/dmdikJhdCP1Ih1D4l25pBAEknjAyY0e7J+bhm6BfBZivWVqeyYnel685MOOsQJvXXqsH5mh27Y5HFqhWsZ0sMqMQQV+4nhgd8/quRCNQIkeb8CWbvHTCeASLWiU0CgYBlt64XAY97rVlVxs5Tla2w+Kz4ZV/OKzoONElCCvz9Nk47t5XV+tDMCa3LQYAtD6gX/PoP2S/XO/15pStUvcWesOf5q34Bms0739JyrNN+Ca9ur6TndSx85Mds9PiFCGWcxZqHyuFnp79bdP5Cj2uU4/2n3dogQD7T/anVxgmAlQKBgF2DJJdE+pJ0rphKtzUlFy6NemL2hst+nq6hnJx+8ltYXSrsNYIl5wTxuktV1oszm+PFMgH3dCAw4igpr6SmFyIs3Meqf2mBVKf9xVddX1Q53DBmwQge5uMl4E6TW5VVmt1TOwhjhV9cCDPU9BzQeHUkXJiWyUd1Olu85Hfl+dTb";
    CertAlipayRequest alipayConfig = new CertAlipayRequest();
    alipayConfig.setPrivateKey(privateKey);
    alipayConfig.setServerUrl("https://openapi-sandbox.dl.alipaydev.com/gateway.do");
    alipayConfig.setAppId("9021000141623931");
    alipayConfig.setCharset("UTF-8");
    alipayConfig.setSignType("RSA2");
    alipayConfig.setEncryptor("");
    alipayConfig.setFormat("json");
    alipayConfig.setCertContent(
        "-----BEGIN CERTIFICATE-----\nMIIDmTCCAoGgAwIBAgIQICQQEnsfUZrtDxdyKkf/fDANBgkqhkiG9w0BAQsFADC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h0lIs8uVQO65kAztEMuEXwieCXoqH4TL5VZrCFD2S0hr\nX37i7idnZxJHRiuUSgfuQcwB+Le44S6zbB4kit87xFvwiJEHaXuB/o6dH036oSI1K4JY/TcUAUhh\nqZFMyr+ok9P1/1jrhw==\n-----END CERTIFICATE-----");
    alipayConfig.setAlipayPublicCertContent(
        "-----BEGIN CERTIFICATE-----\nMIIDszCCApugAwIBAgIQICQQEo9oiREAuOqK2vmu2TANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE\nBhMCQ04xGzAZBgNVBAoMEkFudCBGaW5hbmNpYWwgdGVzdDElMCMGA1UECwwcQ2VydGlmaWNhdGlv\nbiBBdXRob3JpdHkgdGVzdDE+MDwGA1UEAww1QW50IEZpbmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1\ndGhvcml0eSBDbGFzcyAyIFIxIHRlc3QwHhcNMjQxMDEyMTQwMzUzWhcNMjUxMDEyMTQwMzUzWjCB\nhDELMAkGA1UEBhMCQ04xHzAdBgNVBAoMFmJ5Y3FhdTgyNzNAc2FuZGJveC5jb20xDzANBgNVBAsM\nBkFsaXBheTFDMEEGA1UEAww65pSv5LuY5a6dKOS4reWbvSnnvZHnu5zmioDmnK/mnInpmZDlhazl\nj7gtMjA4ODcyMTA0Njk3MjE1MjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKYetv7K\nTRD/Gzt6lo2ncccfe20voyXqRAtcvkcJOtwS/b0wmeFNxNH8uJQizqmls2NSUscVbCH+TXj2gURP\nZs0aGGQkF/0gsAmlOhHXCWlBPaso2zFifdxfbGyoOOvjWnmkcPKY+ieeo9AmuJQyD1iaUQBj+UVB\nU9k0TnMmwh2EEnLHmNpg8K0MBMYzadghAaNOnwp415Mx4ZRYGUt2//I46K3F0RZhi3LVBKR5vASN\nKJ0RDTyG5L3l0umd5o0xL2T03XUhIS/hn3aTb6igFAyJStSLNc5IBiix42rd9F7DoS4pb3CQRcdF\nVLz322EQGrthGuEgHUjr1u4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GLqM1g\r\nKgWKYfcTGdbPB1MCAwEAAaNjMGEwHQYDVR0OBBYEFG/oAMxTVe7y0+408CTAK8hA\r\nuTyRMB8GA1UdIwQYMBaAFG/oAMxTVe7y0+408CTAK8hAuTyRMA8GA1UdEwEB/wQF\r\nMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBLnUTfW7hp\r\nemMbuUGCk7RBswzOT83bDM6824EkUnf+X0iKS95SUNGeeSWK2o/3ALJo5hi7GZr3\r\nU8eLaWAcYizfO99UXMRBPw5PRR+gXGEronGUugLpxsjuynoLQu8GQAeysSXKbN1I\r\nUugDo9u8igJORYA+5ms0s5sCUySqbQ2R5z/GoceyI9LdxIVa1RjVX8pYOj8JFwtn\r\nDJN3ftSFvNMYwRuILKuqUYSHc2GPYiHVflDh5nDymCMOQFcFG3WsEuB+EYQPFgIU\r\n1DHmdZcz7Llx8UOZXX2JupWCYzK1XhJb+r4hK5ncf/w8qGtYlmyJpxk3hr1TfUJX\r\nYf4Zr0fJsGuv\r\n-----END CERTIFICATE-----");
    // 如果不使用content的模式,那么这里需要自行设置文件的绝对路径
    // alipayConfig.setCertPath("cert的绝对路径");
    // alipayConfig.setAlipayPublicCertPath("AlipayPublicCertPath的绝对路径");
    // alipayConfig.setRootCertPath("RootCertPath的绝对路径");
    AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
    AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
    AlipayTradePrecreateModel model = new AlipayTradePrecreateModel();
    model.setOutTradeNo("20150320010101002");
    model.setTotalAmount("88.88");
    model.setSubject("Iphone6 16G");
    request.setBizModel(model);
    AlipayTradePrecreateResponse response = alipayClient.certificateExecute(request);
    System.out.println(response.getBody());
    if (response.isSuccess()) {
      System.out.println("调用成功");
    } else {
      System.out.println("调用失败");
      // sdk版本是"4.38.0.ALL"及以上,可以参考下面的示例获取诊断链接
      // String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response);
      // System.out.println(diagnosisUrl);
    }
  }
}
